package mds.chenji.against;

import java.io.File;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

import mds.chenji.against.Task.Task;
import mds.chenji.against.command.CommandAgainst;
import mds.chenji.against.gameroom.GlobalRoomGUI;
import mds.chenji.against.listen.BoundaryListen;
import mds.chenji.against.listen.Listen;
import mds.chenji.against.manager.CommandAta;
import mds.chenji.against.manager.CommandRM;
import mds.chenji.against.manager.ConfigManager;

public class Main extends JavaPlugin {

	public static BukkitTask t;
	public static File datafolder;

	public void onEnable() {
		datafolder = getDataFolder();
		ConfigManager.loadConfig();
		Bukkit.getPluginManager().registerEvents(new Listen(), this);
		Bukkit.getPluginManager().registerEvents(new BoundaryListen(), this);
		t = Bukkit.getScheduler().runTaskTimer(this, new Task(), 24, 24);
		getCommand("against").setExecutor(new CommandAgainst());
		getCommand("ata").setExecutor(new CommandAta());
		getCommand("rm").setExecutor(new CommandRM());
		ConfigManager.ReloadRoom();
		GlobalRoomGUI.loadRoom();

	}

	public void onDisable() {
		t.cancel();
	}

}
